package cn.stazxr.pool;

import com.alibaba.druid.pool.DruidDataSourceFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.sql.DataSource;
import java.io.IOException;
import java.util.Properties;

/**
 * @author talentestors
 * @version 1.0
 * @since 2025.05.21
 **/
public class DataSourceUtil {

	private static final Logger log = LoggerFactory.getLogger(DataSourceUtil.class);

	public static DataSource DATASOURCE = null;

	static {
		Properties properties = new Properties();
		try {
			properties.load(PoolTest.class.getClassLoader().getResourceAsStream("jdbc.properties"));
		} catch (IOException e) {
			log.error(e.getMessage());
		}

		try {
			DATASOURCE = DruidDataSourceFactory.createDataSource(properties);
		} catch (Exception e) {
			log.error(e.getMessage());
		}

	}

}
